<!DOCTYPE HTML>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<title>Highcharts Example</title>
		<!-- 1. Add these JavaScript inclusions in the head of your page -->
		
		
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js" type="text/javascript"></script>
        
            

		<!-- CSV export -->
		<script type="text/javascript" src="../ykAnalytics2/resources/scripts/table2CSV.js"></script>
		
		<!-- 2. Add the JavaScript to initialize the chart on document ready -->
        

        
        
        <script type="text/javascript">
        
        function getParameter(param)
{
var query = window.location.search;
var iLen = param.length;
var iStart = query.indexOf(param);
if (iStart == -1)
   return "";
iStart += iLen + 1;
var iEnd = query.indexOf("&", iStart);
if (iEnd == -1)
   return query.substring(iStart);
return query.substring(iStart, iEnd);
}
        
        
        //alert( getParameter('ss'));
        
        var osID = getParameter('os');
        
        var typeID = getParameter('dt');
        
        var marketID = getParameter('pm');
        
        var sd = getParameter('staDate');
        
        var pd = getParameter('pd');
        
        if(sd == ""){ sd = "2012/05/01"; }
        if(pd == ""){ pd = "30"http://tt.youku.com/; }
        
        
        var APIurl = "/client/newmainpaike?items=UV,VV,NU,VVUV,NR,SU,FU,transcodetime,sd,hd,hd2,c01,c12,c23,c34,c45,c5," + "&dao=desc&staDate=" + sd + "&pd="+pd;
        
        if (osID != ""){
				APIurl += "&os="+osID;
            }
			if (typeID != ""){
				APIurl += "&dt="+typeID;
            }
			if (marketID != ""){
				APIurl += "&pm="+marketID;
            }
        
        
        
        $.ajax({
  url:APIurl,
  type: "GET",
  dataType : "json",
success: function(con){
    
   var _data = con['All']['table'];
   
   var divID = 'table123';
   
   table = "<table border = \"1\" class='new_silver_table' id='" + divID + "X'><thead><tr><th style='cursor: pointer;' class='new_silver_first_n asc_table' id='"+divID+"th1' onclick=\" tableSorting('"+divID+"', 1); \" >日期</th>";
   
   table +=  "<th>UV</th><th>VV</th><th>NU</th><th>VV/UV</th><th>注册用户数</th><th>上传成功量</th><th>上传失败量</th><th>平均转码时长(s)</th><th>标清</th><th>高清</th><th>超清</th><th>0-1分钟</th><th>1-2分钟</th><th>2-3分钟</th><th>3-4分钟</th><th>4-5分钟</th><th>5分钟以上</th>";
   
   table += "</tr></thead><tbody>";
   
   table += _data;
    
    table += "</tfoot></table>";
    
    $("#chu").html(table);
    
    
    $("#tijiao").click();
    
    
  

}
  
  
  
});
        
        
        </script>
        
        
        
        <script>
        
        function check_os() {
	var os_type = "MS Windows";
	windows = (navigator.userAgent.indexOf("Windows",0) != -1)?1:0;
	mac = (navigator.userAgent.indexOf("Mac",0) != -1)?1:0;
	linux = (navigator.userAgent.indexOf("Linux",0) != -1)?1:0;
	unix = (navigator.userAgent.indexOf("X11",0) != -1)?1:0;
 
	if (windows) os_type = "MS Windows";
	else if (mac) os_type = "Apple mac";
	else if (linux) os_type = "Lunix";
	else if (unix) os_type = "Unix";
 
	return os_type;
}
        
        
        function getCSVData(tableID){
            
                var tabc = $('#'+tableID).html();
                $('#'+tableID).html(tabc);

				var os = check_os();
				if (os == "MS Windows" || os == "Lunix" || os == "Unix")
					var csv_value=$('#'+tableID).table2CSV({delivery:'value'});
				else if (os == "Apple mac")
					var csv_value=$('#'+tableID).table2CSV({delivery:'value', separator : ';'});
                
                
                
                
                //alert(tabc.replace(/<tr type=\"nomore\"[\s\S]*?<\/tr>/gi,''));
               // str.table2CSV({delivery:'value'});
                
                
                 $("#csv_text").val(csv_value);	
				 document.formCSV.submit();
			}
            
        </script>
	</head>
	<body>
    
    <style>
    .verdiv{float:left;width:75px;border:1px;solid;black}
    </style>
    <div id = "xian"></div>

<div id="chu">

</div>




<input type="button" value='提交表单' id="tijiao" onclick="getCSVData('table123X')" />
<form action="http://10.103.13.104:8001/client/getcsv" method ="get" name="formCSV" accept-charset="utf8" > 
		<input type="hidden" name="csv_text" id="csv_text">
        </form>

		
				
	</body>
</html>
